package com.jxwifi.cloud.quickclean.adapter;

import android.support.annotation.LayoutRes;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jxwifi.cloud.quickclean.R;
import com.jxwifi.cloud.quickclean.app.StateUtils;
import com.jxwifi.cloud.quickclean.bean.OrderBean;

/**
 * Created by Administrator on 2019/6/14.
 */

public class ClientMyOrderListAdapter extends BaseQuickAdapter<OrderBean, BaseViewHolder> {

    private String mOrderSta;

    public ClientMyOrderListAdapter(@LayoutRes int layoutResId) {
        super(layoutResId, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderBean item) {
        helper.setText(R.id.tv_list_my_order_type_name,item.getProductName());
        StatusSet(item.getOrderStatus());
        helper.setText(R.id.tv_list_my_order_type_progress,mOrderSta);
        helper.setText(R.id.tv_list_my_order_id,item.getOrderCode());
        helper.setText(R.id.tv_list_my_order_time,item.getServiceTime());
        helper.setText(R.id.tv_list_my_order_address,item.getProvince()+""+item.getCity()+""+item.getArea()+""+item.getAddress());
        helper.addOnClickListener(R.id.lin_list_my_order);
    }

    public void StatusSet(String orderstatus){
        if (StateUtils.DP_ING.equals(orderstatus)){
            mOrderSta="派单中";
        }else if (StateUtils.SER_START.equals(orderstatus)){
            mOrderSta="已派单";
        }else if (StateUtils.SER_LEAVE.equals(orderstatus)){
            mOrderSta="已出发";
        }else if (StateUtils.SER_ARRIVE.equals(orderstatus)){
            mOrderSta="已到达";
        }else if (StateUtils.SER_TIME_START.equals(orderstatus)){
            mOrderSta="已开始";
        }else if (StateUtils.SER_TIME_STOP.equals(orderstatus)){
            mOrderSta="已暂停";
        }else if (StateUtils.SER_TIME_START_RE.equals(orderstatus)){
            mOrderSta="计时重新开始";
        }else if (StateUtils.CANCEL.equals(orderstatus)){
            mOrderSta="已取消";
        }else if (StateUtils.OUT_TIME_CANCEL.equals(orderstatus)){
            mOrderSta="已过期";
        }else if (StateUtils.SER_FINISHED.equals(orderstatus)){
            mOrderSta="已完成(待支付)";
        }else if (StateUtils.SER_END.equals(orderstatus)){
            mOrderSta="已完成(已支付)";
        }


    }
}
